<?php /* Smarty version Smarty-3.1.12, created on 2013-05-11 21:04:15
         compiled from "D:\wamp\www\acps_new\templates\tasks\edit.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1763950ba83316d87a6-17564574%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'db82c1cf99240a7068f5bf2a56ea9ba884a8fc99' => 
    array (
      0 => 'D:\\wamp\\www\\acps_new\\templates\\tasks\\edit.tpl',
      1 => 1368306253,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1763950ba83316d87a6-17564574',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.12',
  'unifunc' => 'content_50ba83318db830_13512126',
  'variables' => 
  array (
    'data' => 0,
    'client' => 0,
    'responsible' => 0,
    'status' => 0,
    'type' => 0,
    'goods' => 0,
    'operation' => 0,
    'priority' => 0,
    'ptype' => 0,
    'tariff' => 0,
    'user' => 0,
    'rights' => 0,
    'record' => 0,
    'counter' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_50ba83318db830_13512126')) {function content_50ba83318db830_13512126($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ($_smarty_tpl->tpl_vars['data']->value['pathToError'], $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<script type="text/javascript">
    
        
    function setPostsToDescription() {
        var alls = $('.post_to_desc:checkbox:checked');
        var desc = '';
        alls.each(function(){
            var id = $(this).val();
            var text = $("#post_to_desc_"+id).val();
            desc += text + '; ';
        });    
        //if (desc != '') {
            title = desc;

            var regex = /(<([^>]+)>)/ig;
            var title = title.replace(regex, "");

            $("#rdescription").val(title);
        //}
    }
        
    function showRecordForm(){
        var display = $(".inlineFormTr").css("display");
        if (display == 'none') {
            setPostsToDescription();
            if ($.browser.msie)
                $(".inlineFormTr").css("display", "block");
            else
                $(".inlineFormTr").css("display", "table-row");
            $("#rdate").focus();       
        } else {
            $(".inlineFormTr").css("display", "none");
            $("#title").focus();           
        }
    }
        
    function sendAction(action){
        $("#action").val(action);
        $("#editing").submit();    
    }    
        
    function showOther(){
        var display = $("#otherTable").css("display");
        if (display == "none"){
            $("#other").empty();
            $("#other").append("- Task features");
            $("#otherTable").show();
            $("#showOther").val("1");
        } else {
            $("#other").empty();
            $("#other").append("+ Task features");
            $("#otherTable").hide();
            $("#showOther").val("0");
        }
    }
    
    function showTaskTypeTable(id){
        $("#taskType").removeClass("bgSpecial1");
        $(".external").hide();    
        if (id==8 || id==9){
            $("#taskType").addClass("bgSpecial1");
            $("#taskType"+id).show();
        }
    }
    
    function change_responsible(id){
        if (id!=""){
            $("#responsible option[value="+id+"]").attr("selected", "selected");
            $("#worker option[value="+id+"]").attr("selected", "selected");
        } else {
            $("#responsible option[value=-1]").attr("selected", "selected");
            $("#worker option[value=-1]").attr("selected", "selected");
        }
    }
        
    function change_worker(id){
        $("#worker option").removeAttr("selected");
        $("#worker option[value="+id+"]").attr("selected", "selected");
    }
        
    function changeTariffs(value, target){
        if (typeof(target) == 'undefined')
            target = 'rtariff';
        
        if (value!=-1){
            
            var data = {
                action : 'change_tariffs',
                params: {
                    type: value
                }
            }

            var result = false;

            ajax(data, function (data) {
                if (data.result==0){
                    $("#"+target).empty();
                    $("#"+target).append('<option value="-1">Please select</option>');
                    result = false;
                } else {
                    $("#"+target).empty();
                    $("#"+target).append('<option value="-1">Please select</option>');
                    $("#"+target).append(data.options)
                    result = true;
                }
            });

            return result;
            
        }
    }
        
    function fillPrice(value, target){
        if (typeof(target) == 'undefined')
            target = 'rprice';
        if (value!=-1){
            
            var data = {
                action : 'fill_price',
                params: {
                    tariff: value
                }
            }

            var result = false;

            ajax(data, function (data) {
                if (data.result==0){
                    $("#"+target).val("0.00");
                    result = false;
                } else {
                    $("#"+target).val(data.price);
                    makeFloat(".double",2);
                    result = true;
                }
            });

            return result;
            
        }
    }
        
    $(document).ready(function() {
        $("#created").datepicker({ 
            dateFormat: "dd/mm/yy",
            firstDay: 1      
        });
        $("#deadline").datepicker({ 
            dateFormat: "dd/mm/yy" ,
            firstDay: 1     
        });
        $("#date_of_action").datepicker({ 
            dateFormat: "dd/mm/yy" ,
            firstDay: 1     
        }); 
        $("#delivery").datepicker({ 
            dateFormat: "dd/mm/yy" ,
            firstDay: 1     
        }); 
        $(".float").change(function() {
            makeFloat(".float",1);
        });
        $("#rdate").datepicker({ 
            dateFormat: "dd/mm/yy" ,
            firstDay: 1     
        });
        $("#rdate_edit").datepicker({ 
            dateFormat: "dd/mm/yy" ,
            firstDay: 1     
        });
        $(".double").change(function() {
            makeFloat(".double",2);
        }) 
    
<?php if ($_smarty_tpl->tpl_vars['data']->value['isCopy']==1){?>showRecordForm()<?php }?>

        showTaskTypeTable(<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['type'];?>
);
    });

</script>

<h2 class="pageTitle">Edit task</h2>

<form class="adding" id="editing" action="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
?input=edit_task&task=<?php echo $_REQUEST['task'];?>
" method="post" onsubmit="return checkAdd_task(
                                                                    $('#title').val(), 
                                                                    $('#client').val(),
                                                                    $('#responsible').val(),
                                                                    $('#deadline').val(), 
                                                                    $('#type').val(), 
                                                                    $('input:radio[name=task_data[status]]:checked').val(), 
                                                                    $('input:radio[name=task_data[priority]]:checked').val(), 
                                                                    'prazdno')">
    <table class="tableForm">
        <tr>
            <td>
                <label for="title">Title <span class="red">*</span> </label>
            </td>
            <td>
                <input name="task_data[title]" id="title" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['title'];?>
" size="20" />
            </td>
            <td rowspan="5" style="width: 760px">
                Description:
                <?php echo $_smarty_tpl->getSubTemplate ("include/phorum.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

                New post:<br/><textarea cols="70" rows="5" name="phorum[text]"></textarea>
            </td>
        </tr>
        <tr>
            <td>
                <label for="client">Client <span class="red">*</span> </label>
            </td>
            <td>
                <select name="task_data[client]" id="client" size="1" onchange="change_responsible($('#client option:selected').attr('class'))">
                    <option value="-1">Please select</option>
                    <?php  $_smarty_tpl->tpl_vars['client'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['client']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['clients']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['client']->key => $_smarty_tpl->tpl_vars['client']->value){
$_smarty_tpl->tpl_vars['client']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['client']->key;
?>
                        <option <?php if ($_SESSION['user']['user_type_id']!=@USER_TYPE_CLIENT&&$_smarty_tpl->tpl_vars['client']->value['bad_payer']==1){?>style="background: #ff545e"<?php }?> class="<?php echo $_smarty_tpl->tpl_vars['client']->value['contactPerson'];?>
" <?php if ($_smarty_tpl->tpl_vars['client']->value['klient_id']==$_smarty_tpl->tpl_vars['data']->value['task_data']['client']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['client']->value['klient_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['client']->value['name'];?>
</option>
                    <?php } ?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <label for="responsible">Responsible <span class="red">*</span> </label>
            </td>
            <td>
                <select name="task_data[responsible]" id="responsible" size="1" onchange="change_worker(this.value)">
                    <option value="-1">Please select</option>
                    <?php  $_smarty_tpl->tpl_vars['responsible'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['responsible']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['responsibles']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['responsible']->key => $_smarty_tpl->tpl_vars['responsible']->value){
$_smarty_tpl->tpl_vars['responsible']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['responsible']->key;
?>
                        <option value="<?php echo $_smarty_tpl->tpl_vars['responsible']->value['users_id'];?>
" <?php if ($_smarty_tpl->tpl_vars['responsible']->value['users_id']==$_smarty_tpl->tpl_vars['data']->value['task_data']['responsible']){?>selected="selected"<?php }?>><?php echo $_smarty_tpl->tpl_vars['responsible']->value['surname'];?>
, <?php echo $_smarty_tpl->tpl_vars['responsible']->value['name'];?>
</option>
                    <?php } ?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <label for="worker">Worker</label>
            </td>
            <td>
                <select name="task_data[worker]" id="worker" size="1">
                    <option value="-1">Please select</option>
                    <?php  $_smarty_tpl->tpl_vars['responsible'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['responsible']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['responsibles']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['responsible']->key => $_smarty_tpl->tpl_vars['responsible']->value){
$_smarty_tpl->tpl_vars['responsible']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['responsible']->key;
?>
                        <option value="<?php echo $_smarty_tpl->tpl_vars['responsible']->value['users_id'];?>
" <?php if ($_smarty_tpl->tpl_vars['responsible']->value['users_id']==$_smarty_tpl->tpl_vars['data']->value['task_data']['worker']){?>selected="selected"<?php }?>><?php echo $_smarty_tpl->tpl_vars['responsible']->value['surname'];?>
, <?php echo $_smarty_tpl->tpl_vars['responsible']->value['name'];?>
</option>
                    <?php } ?>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <label for="deadline">Deadline <span class="red">*</span> </label>
            </td>
            <td>
                <input name="task_data[deadline]" id="deadline" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['deadline'];?>
" />
            </td>
        </tr>
        <tr>
            <td><label for="duration">Expected amount</label></td>
            <td>
                <input class="float" name="task_data[duration]" id="duration" type="text" size="5" maxlength="5" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['duration'];?>
" />
            </td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td colspan="3"><a style="color: black; text-decoration: none;" href="javascript: showOther()"><b id="other">+ Task features</b></a></td>
        </tr>
        <tr id="otherTable" class="bgGray">
            <td colspan="3">
                <table style="width: auto">
                    <tr>
                        <td>
                            <label for="status">Status <span class="red">*</span> </label>
                        </td>
                        <td>
                            <input name="oldStatus" type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['status'];?>
" />
                            <?php  $_smarty_tpl->tpl_vars['status'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['status']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['statuses']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['status']->key => $_smarty_tpl->tpl_vars['status']->value){
$_smarty_tpl->tpl_vars['status']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['status']->key;
?>
                                <input <?php if ($_smarty_tpl->tpl_vars['status']->value['id_stav']==$_smarty_tpl->tpl_vars['data']->value['task_data']['status']){?>checked="checked"<?php }?>name="task_data[status]" type="radio" value="<?php echo $_smarty_tpl->tpl_vars['status']->value['id_stav'];?>
" />&nbsp;<?php echo $_smarty_tpl->tpl_vars['status']->value['stav'];?>
<br/>
                            <?php } ?>
                        </td>
                        <td></td>
                    </tr>
                    <tr id="taskType">
                        <td>
                            <label for="type">Task type <span class="red">*</span> </label>
                        </td>
                        <td>
                            <select name="task_data[type]" id="type" size="1" onchange="showTaskTypeTable(this.value)">
                                <?php  $_smarty_tpl->tpl_vars['type'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['type']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['type']->key => $_smarty_tpl->tpl_vars['type']->value){
$_smarty_tpl->tpl_vars['type']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['type']->key;
?>
                                    <option <?php if ($_smarty_tpl->tpl_vars['type']->value['Id']==$_smarty_tpl->tpl_vars['data']->value['task_data']['type']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['type']->value['Id'];?>
"><?php echo $_smarty_tpl->tpl_vars['type']->value['type_of_record'];?>
</option>
                                <?php } ?>
                            </select>
                        </td>
                        <td rowspan="5" id="external">
                            <table class="external bgSpecial1" id="taskType8">
                                <tr>
                                    <td style="width: 20em">Expected date of delivery</td>
                                    <td><input name="goods[delivery]" type="text" id="delivery" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['order_of_goods']['delivery'];?>
" /></td>
                                </tr>
                                <tr>
                                    <td style="width: auto">Real delivery time</td>
                                    <td><input name="goods[real]" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['order_of_goods']['real'];?>
" /></td>
                                </tr>
                                <tr>
                                    <td>Type of goods</td>
                                    <td>
                                        <select name="goods[type_of_good]" size="1">
                                            <?php  $_smarty_tpl->tpl_vars['goods'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['goods']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['goods_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['goods']->key => $_smarty_tpl->tpl_vars['goods']->value){
$_smarty_tpl->tpl_vars['goods']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['goods']->key;
?>
                                                <option value="<?php echo $_smarty_tpl->tpl_vars['goods']->value['id'];?>
" <?php if ($_smarty_tpl->tpl_vars['goods']->value['id']==$_smarty_tpl->tpl_vars['data']->value['task_data']['order_of_goods']['type_of_good']){?>selected="selected"<?php }?>><?php echo $_smarty_tpl->tpl_vars['goods']->value['type'];?>
</option>
                                            <?php } ?>
                                        </select> 
                                    </td>
                                </tr>
                            </table>
                            <table class="external bgSpecial1" id="taskType9">
                                <tr>
                                    <td>Operation</td>
                                    <td>
                                        <select name="operation[operation]" size="1">
                                            <option value="">Please select</option>
                                            <?php  $_smarty_tpl->tpl_vars['operation'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['operation']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['operation_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['operation']->key => $_smarty_tpl->tpl_vars['operation']->value){
$_smarty_tpl->tpl_vars['operation']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['operation']->key;
?>
                                                <option <?php if ($_smarty_tpl->tpl_vars['operation']->value['id']==$_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['operation']){?>selected="selected"<?php }?>value="<?php echo $_smarty_tpl->tpl_vars['operation']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['operation']->value['operation'];?>
</option>
                                            <?php } ?>
                                        </select> 
                                    </td>
                                    <td>Date of operation</td>
                                    <td><input name="operation[date_of_action]" type="text" id="date_of_action" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['date_of_action'];?>
" /></td>
                                </tr>
                                <tr>
                                    <td>Name</td>
                                    <td><input name="operation[name]" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['name'];?>
" /></td>
                                    <td>Surname</td>
                                    <td><input name="operation[surname]" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['surname'];?>
" /></td>
                                </tr>
                                <tr>
                                    <td>Title</td>
                                    <td><input name="operation[title]" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['title'];?>
" /></td>
                                    <td>External address</td>
                                    <td><input name="operation[address]" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['address'];?>
" /></td>
                                </tr>
                                <tr>
                                    <td>Phone Number</td>
                                    <td><input name="operation[phone]" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['phone'];?>
" /></td>
                                    <td>Email</td>
                                    <td><input name="operation[email]" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['email'];?>
" /></td>
                                </tr>
                                <tr>
                                    <td>Position</td>
                                    <td><input name="operation[position]" type="text"  value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['position'];?>
"/></td>
                                    <td>Department</td>
                                    <td><input name="operation[department]" type="text"  value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['operation_with_user']['department'];?>
"/></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="created">Task start <span class="red"></span> </label>
                        </td>
                        <td>
                            <input name="task_data[created]" id="created" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['created'];?>
" />
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>
                            <label for="priority">Priority <span class="red">*</span> </label>
                        </td>
                        <td>
                            <?php  $_smarty_tpl->tpl_vars['priority'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['priority']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['priorities']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['priority']->key => $_smarty_tpl->tpl_vars['priority']->value){
$_smarty_tpl->tpl_vars['priority']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['priority']->key;
?>
                                <input <?php if ($_smarty_tpl->tpl_vars['priority']->value['id']==$_smarty_tpl->tpl_vars['data']->value['task_data']['priority']){?>checked="checked"<?php }?>name="task_data[priority]" type="radio" value="<?php echo $_smarty_tpl->tpl_vars['priority']->value['id'];?>
" />&nbsp;<?php echo $_smarty_tpl->tpl_vars['priority']->value['Priorita'];?>
 - <?php echo $_smarty_tpl->tpl_vars['priority']->value['Popis'];?>
<br/>
                            <?php } ?>
                        </td>
                    </tr>
                    <tr>
                        <td><label for="problem_type">Type of problem</label></td>
                        <td>
                            <select name="task_data[problem_type]" id="problem_type" size="1" >
                                <option value="">Please select</option>
                                <?php  $_smarty_tpl->tpl_vars['ptype'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['ptype']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['problem_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['ptype']->key => $_smarty_tpl->tpl_vars['ptype']->value){
$_smarty_tpl->tpl_vars['ptype']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['ptype']->key;
?>
                                    <option <?php if ($_smarty_tpl->tpl_vars['data']->value['task_data']['problem_type']==$_smarty_tpl->tpl_vars['ptype']->value['id']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['ptype']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['ptype']->value['problem'];?>
</option>
                                <?php } ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><label for="consult">Consult at a meeting</label></td>
                        <td>
                            <input <?php if ($_smarty_tpl->tpl_vars['data']->value['task_data']['consult']==1){?>checked="checked"<?php }?> name="task_data[consult]" id="consult" type="checkbox" value="1" />
                            <input name="showOther" id="showOther" type="hidden" value="0" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" style="padding: 0; padding-bottom: 5px">
                            <?php if ($_SESSION['user']['user_id']==$_smarty_tpl->tpl_vars['data']->value['task_data']['creator']){?>
                                <a style="line-height: 25px; color: red" href="javascript: deleteTask(<?php echo $_smarty_tpl->tpl_vars['data']->value['task_data']['taskId'];?>
)"><img src="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
images/delete.png" title="" alt="" height="25" width="25" style="float: left; margin-right: 3px" /> DELETE</a>
                                <?php }?>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr class="submitRow">
            <td>
                <input name="action" value="addTask" type="hidden" id="action" />
                <span class="red">* Required</span>
            </td>
            <td colspan="2">
                <input type="button" value="Save" name="add_task" onclick="sendAction('addTask')" /> &nbsp; 
                <input type="button" value="Save & Send" name="add_task" onclick="sendAction('addTask_send')" /> &nbsp; 
                <input type="button" value="Save & Complete & Send" name="add_task" onclick="sendAction('addTask_complete_send')" /> &nbsp; 
                
            </td>
        </tr>
    </table>
</form>

<?php if ($_SESSION['user']['user_type_id']!=@USER_TYPE_CLIENT){?>
    <div class="menu-list">
        <a href="javascript: showRecordForm()" class="basicButton">Add new record</a> *required
    </div>
    <form class="adding" action="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
?input=edit_task&task=<?php echo $_REQUEST['task'];?>
" method="post" onsubmit="return checkAdd_record(
                                                                    $('#rdate').val(), 
                                                                    $('#rclient').val(),
                                                                    $('#rtype').val(),
                                                                    $('#ramount').val(),
                                                                    $('#rprice').val(),
                                                                    $('#rdescription').val()
                                                                                   )">
        <table class="inlineForm">
            <tr>
                <th style="width: 100px" ><label for="rdate">Date *</label></th>
                <th style="width: 120px" ><label for="rclient">Client *</label></th>
                <th style="width: 150px" ><label for="rtype">Type of record *</label></th>
                <th style="width: 80px"><label for="ramount">Amount *</label></th>
                <th style="width: 120px"><label for="rtariff">Tariff</label></th>
                <th style="width: 200px" ><label for="rdescription">Description *</label></th>
                <th style="width: 80px"><label for="rprice">Unit price *</label></th>
                <th style="width: 120px"><label for="ruser_id">Added by</label></th>
                <th style="width: 50px"><label for="rattention"></label></th>
                <th style="width: 50px"></th>
                <th style="width: 50px"></th>
            </tr>
            <?php if ($_SESSION['user']['user_type_id']!=@USER_TYPE_CLIENT){?>
                <tr class="inlineFormTr">
                    <td style="width: 100px" >
                        <input style="width: 100px" name="record[date]" id="rdate" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['prefill']['date'];?>
"/>
                    </td>
                    <td style="width: 120px" >
                        <select style="width: 120px" name="record[client]" id="rclient" size="1" >
                            <option value="-1">Please select</option>
                            <?php  $_smarty_tpl->tpl_vars['client'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['client']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['clients']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['client']->key => $_smarty_tpl->tpl_vars['client']->value){
$_smarty_tpl->tpl_vars['client']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['client']->key;
?>
                                <option <?php if ($_SESSION['user']['user_type_id']!=@USER_TYPE_CLIENT&&$_smarty_tpl->tpl_vars['client']->value['bad_payer']==1){?>style="background: #ff545e"<?php }?> <?php if ($_smarty_tpl->tpl_vars['data']->value['prefill']['client']==$_smarty_tpl->tpl_vars['client']->value['klient_id']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['client']->value['klient_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['client']->value['name'];?>
</option>
                            <?php } ?>
                        </select>
                    </td>
                    <td style="width: 150px" >
                        <select style="width: 150px" name="record[type]" id="rtype" size="1" onchange="changeTariffs(this.value)">
                            <option value="-1">Please select</option>
                            <?php  $_smarty_tpl->tpl_vars['type'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['type']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['rtypes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['type']->key => $_smarty_tpl->tpl_vars['type']->value){
$_smarty_tpl->tpl_vars['type']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['type']->key;
?>
                                <option <?php if ($_smarty_tpl->tpl_vars['type']->value['Id']==$_smarty_tpl->tpl_vars['data']->value['prefill']['type']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['type']->value['Id'];?>
"><?php echo $_smarty_tpl->tpl_vars['type']->value['type_of_record'];?>
</option>
                            <?php } ?>
                        </select>
                    </td>
                    <td style="width: 80px" >
                        <input style="width: 80px" name="record[amount]" id="ramount" class="float" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['prefill']['amount'];?>
"  />
                    </td>
                    <td style="width: 120px" >
                        <select style="width: 120px" name="record[tariff]" id="rtariff" size="1" onchange="fillPrice(this.value); fillDescription('#rdescription', this.value)">
                            <option value="-1">Please select</option>
                            <?php  $_smarty_tpl->tpl_vars['tariff'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['tariff']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['rtariffs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['tariff']->key => $_smarty_tpl->tpl_vars['tariff']->value){
$_smarty_tpl->tpl_vars['tariff']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['tariff']->key;
?>
                                <option <?php if ($_smarty_tpl->tpl_vars['tariff']->value['Id']==$_smarty_tpl->tpl_vars['data']->value['prefill']['tariff']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['tariff']->value['Id'];?>
"><?php echo $_smarty_tpl->tpl_vars['tariff']->value['title'];?>
</option>
                            <?php } ?>
                        </select>
                    </td>
                    <td style="width: 200px" >
                        <input style="width: 200px" name="record[description]" id="rdescription" type="text" value="<?php if ($_smarty_tpl->tpl_vars['data']->value['prefill']['description']){?><?php echo $_smarty_tpl->tpl_vars['data']->value['prefill']['description'];?>
<?php }?>"/>
                    </td>
                    <td style="width: 80px" >
                        <input style="width: 80px" name="record[price]" id="rprice" class="double" type="text" value="<?php echo $_smarty_tpl->tpl_vars['data']->value['prefill']['unit_price'];?>
" />
                    </td>
                    <td style="width: 120px" >
                        <select style="width: 120px" name="record[user_id]" id="ruser_id" size="1" >
                            <?php  $_smarty_tpl->tpl_vars['user'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['user']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['rusers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['user']->key => $_smarty_tpl->tpl_vars['user']->value){
$_smarty_tpl->tpl_vars['user']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['user']->key;
?>
                                <option <?php if ($_smarty_tpl->tpl_vars['data']->value['prefill']['user_id']==$_smarty_tpl->tpl_vars['user']->value['users_id']){?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['user']->value['users_id'];?>
"><?php echo $_smarty_tpl->tpl_vars['user']->value['name'];?>
 <?php echo $_smarty_tpl->tpl_vars['user']->value['surname'];?>
</option>
                            <?php } ?>
                        </select>
                    </td>
                    <td style="width: 50px" >
                        <input name="record[attention]" type="hidden" value="0" />
                        <input name="record[attention]" type="checkbox" value="1" <?php if ($_smarty_tpl->tpl_vars['data']->value['prefill']['attention']==1){?>checked="checked"<?php }?> />
                    </td>
                    <td style="width: 50px" >
                        <input name="action" value="add_record" type="hidden" />
                        <input type="submit" value="Save" name="add_record" />
                    </td>
                    <td style="width: 50px" ></td>
                </tr> 
            <?php }?>
        </table>
    </form>
<?php }?>

<form action="<?php echo $_smarty_tpl->tpl_vars['data']->value['root'];?>
?input=edit_task&task=<?php echo $_REQUEST['task'];?>
" method="post" onsubmit="return checkAdd_record(
                                                                    $('#rdate_edit').val(), 
                                                                    $('#rclient_edit').val(),
                                                                    $('#rtype_edit').val(),
                                                                    $('#ramount_edit').val(),
                                                                    $('#rprice_edit').val(),
                                                                    $('#rdescription_edit').val()
                                                                                   )">
    <table class="inlineForm">
        <tr>
            <td style="width: 100px" ></td>
            <td style="width: 120px"></td>
            <td style="width: 150px" ></td>
            <td style="width: 80px"></td>
            <td style="width: 120px" ></td>
            <td style="width: 200px" ></td>
            <td style="width: 80px"></td>
            <td style="width: 120px" ></td>
            <td style="width: 50px"></td>
            <td style="width: 50px"></td>
            <td style="width: 50px"></td>
        </tr>

        <?php $_smarty_tpl->tpl_vars['counter'] = new Smarty_variable(1, null, 0);?>
        <?php if ($_smarty_tpl->tpl_vars['data']->value['task_data']['records'][0]){?>
            <?php  $_smarty_tpl->tpl_vars["record"] = new Smarty_Variable; $_smarty_tpl->tpl_vars["record"]->_loop = false;
 $_smarty_tpl->tpl_vars["key"] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['data']->value['task_data']['records']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars["record"]->key => $_smarty_tpl->tpl_vars["record"]->value){
$_smarty_tpl->tpl_vars["record"]->_loop = true;
 $_smarty_tpl->tpl_vars["key"]->value = $_smarty_tpl->tpl_vars["record"]->key;
?>
                <?php if ($_SESSION['user']['user_type_id']!=@USER_TYPE_CLIENT){?>
                    <?php $_smarty_tpl->tpl_vars['rights'] = new Smarty_variable('full', null, 0);?>
                <?php }else{ ?>
                    <?php $_smarty_tpl->tpl_vars['rights'] = new Smarty_variable('nofull', null, 0);?>
                <?php }?>
                <?php echo $_smarty_tpl->getSubTemplate ('record_item.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('type'=>$_smarty_tpl->tpl_vars['rights']->value,'record'=>$_smarty_tpl->tpl_vars['record']->value,'counter'=>$_smarty_tpl->tpl_vars['counter']->value), 0);?>

                <?php if ($_smarty_tpl->tpl_vars['counter']->value==1){?>
                    <?php $_smarty_tpl->tpl_vars['counter'] = new Smarty_variable(2, null, 0);?>
                <?php }else{ ?>
                    <?php $_smarty_tpl->tpl_vars['counter'] = new Smarty_variable(1, null, 0);?>
                <?php }?>
            <?php } ?>
        <?php }else{ ?>    
            <td style="text-align: center; padding: 15px 0; color: #969696" colspan="11">Assigned records do not exist for this task.</td>
        <?php }?>
    </table>
</form>
<?php }} ?>